namespace LightPersist.Transactions
{
	/// <summary>
	/// Store either TheAction or Transaction object
	/// Used to store actions and nested transactions in one stack
	/// </summary>
	internal class ActionEntry
	{
		private readonly object _entry;

		public ActionEntry(Transaction transaction)
		{
			_entry = transaction;
		}

		public ActionEntry(TheAction action)
		{
			_entry = action;
		}

		public bool IsTransaction
		{
			get
			{
				return _entry is Transaction;
			}
		}

		public Transaction AsTransaction
		{
			get
			{
				return _entry as Transaction;
			}
		}

		public TheAction AsAction
		{
			get
			{
				return _entry as TheAction;
			}
		}

		public override string ToString()
		{
			return _entry.ToString();
		}

	}
}